<?php

/**
 * @Author: wuchenge
 * @Date:   2021-12-13 18:02:00
 * @Email: ligui0506@126.com
 * @Descript:
 */
namespace App\Transformer;

abstract class Transformer
{
    /**
     * [transform_collection 多个数组隐藏]
     * @param  [type] $items [description]
     * @return [type]        [description]
     */
    public function transformCollection($items)
    {
        // 说明是集合 Illuminate
        if (!is_array($items)) {
            $items = $items->toArray($items);
        }

        return array_map([$this, 'transform'], $items);
    }

    /**
     * [transform 单个数组隐藏 抽象方法]
     * @param  [type] $item [description]
     * @return [type]       [description]
     */
    abstract public function transform($item);
}
